<!DOCTYPE HTML>
#("#@meta(keywords??'无', description??'无')")
<body>
<nav class="breadcrumb">
    <a class="btn btn-success radius r" id="btn-refresh" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>
<div class="page-container">
    <div class="text-c">
        <form id="queryForm">
        #for(field : table.fields)
        #if(field.propertyName!='id')
        <input type="text" id="#(field.propertyName)" value="#('#(query.'+field.propertyName+'??)')" name="#(field.propertyName)" placeholder="#(field.comment)" style="width:#(100/table.fields.size())%;" class="input-text">
        #end
        #end
        <button name=""  class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        </form>
    </div>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <!--<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>-->
            <a class="btn btn-primary radius" data-title="添加" data-href="article-add.html" onclick="add()" href="javascript:;">
                <i class="Hui-iconfont">&#xe600;</i> 添加
            </a>
        </span>
        <span class="r">共有数据：<strong>#("#(" + table.entityPath + "List.total)")</strong> 条</span>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
            <thead>
            <tr class="text-c">
                <th ><input type="checkbox" name="" value=""></th>
                #for(field : table.fields)
                #if(field.propertyName!='id')
                <th>#(field.comment)</th>
                #end
                #end
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            #("#for(" + table.entityPath + " : " + table.entityPath + "List.records"))
                <tr class="text-c">
                    <td><input type="checkbox" value="#('#(' + table.entityPath +'.id' + ')')" name=""></td>
                    #for(field : table.fields)
                        #if(field.propertyName!='id')
                        #if(field.type == "datetime")
                        <td>#("#date(")#(table.entityPath)#(".")#(field.propertyName)#("??,")#('"')#("yyyy-MM-dd HH:mm:ss")#('")') </td>
                        #else
                        <td>#("#(" + table.entityPath + "." + field.propertyName +"??)") </td>
                        #end
                        #end
                    #end
                    <td>
                        <input class="btn btn-primary radius" type="button" onclick="edit('#("#(" +table.entityPath + ".id" + ")" )')" value="编辑">
                        <input class="btn btn-danger radius" type="button" onclick="del(this, '#("#(" +table.entityPath + ".id" + ")" )')" value="删除">
                    </td>
                </tr>
            #("#end")
            </tbody>
        </table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
#("#@footer()")
<!--/_footer 作为公共模版分离出去-->
#set(obj = table.entityPath +"List")
#("#@jsPage("+obj+")")
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    #set(adminAdd = "/admin")
    /*新增*/
    function add(){
        layer_show("新增", "#(adminAdd)/#(table.entityPath)/info");
    }

    /*编辑*/
    function edit(id){
        layer_show("编辑", "#(adminAdd)/#(table.entityPath)/info/" + id);
    }

    /*删除*/
    function del(obj, id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '#(adminAdd)/#(table.entityPath)/del/' + id,
                dataType: 'json',
                success: function(data){
                    if(data.status == 0 && data.data) {
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
</script>
</body>
</html>